﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace VmcRemote.Common
{
    [Description("Dummy")]
    public class DummyConnection : ConnectionBase
    {
        bool connected = false;

        public DummyConnection(string host, int port) : base(host, port) { }

        protected override bool Connect()
        {
            System.Threading.Thread.Sleep(5000);
            connected = true;
            return connected;
            //throw new NotImplementedException();
        }

        protected override bool Disconnect()
        {
            System.Threading.Thread.Sleep(500);
            connected = false;
            return !connected;
            //throw new NotImplementedException();
        }

        protected override void Send(byte[] bytes)
        {
            if (!connected) throw new InvalidOperationException("Attempted to send message while not connected!");
            System.Diagnostics.Debug.WriteLine("Sending Command: " + new ASCIIEncoding().GetString(bytes, 0, bytes.Length));
            System.Threading.Thread.Sleep(100);
            //throw new NotImplementedException();
        }
    }
}
